﻿@using SmartCode
@using SmartCode.Db
@model BuildContext
@{
    var project = Model.Project;
    var dbSource = Model.GetDataSource<DbSource>();
    var dbProvider = dbSource.DbProvider;
    var writeDataSource = dbSource.WriteDataSource;
}
<?xml version="1.0" encoding="utf-8"?>

<!--
@{ await Html.RenderPartialAsync("Copyright.cshtml", Model); }
-->
<SmartSqlMapConfig xmlns="http://SmartSql.net/schemas/SmartSqlMapConfig.xsd">
    <Settings IsCacheEnabled="true" EnablePropertyChangedTrack="false"/>
    <Properties>
        <Property Name="ConnectionString" Value="@writeDataSource.ConnectionString"/>
        <Property Name="ScriptBuilder" Value="SmartSql.ScriptTag.ScriptBuilder,SmartSql.ScriptTag"/>
        <Property Name="CryptoTypeHandler" Value="SmartSql.TypeHandler.CryptoTypeHandler,SmartSql.TypeHandler"/>
        @if (dbSource.DbRepository.DbProvider == DbProvider.PostgreSql)
        {
            <Property Name="JsonTypeHandler" Value="SmartSql.TypeHandler.PostgreSql.JsonTypeHandler`1,SmartSql.TypeHandler.PostgreSql"/>
            <Property Name="NamedJsonTypeHandler" Value="SmartSql.TypeHandler.PostgreSql.JsonTypeHandler,SmartSql.TypeHandler.PostgreSql"/>
        }
        else
        {
            <Property Name="JsonTypeHandler" Value="SmartSql.TypeHandler.JsonTypeHandler`1,SmartSql.TypeHandler"/>
            <Property Name="NamedJsonTypeHandler" Value="SmartSql.TypeHandler.JsonTypeHandler,SmartSql.TypeHandler"/>
        }
    </Properties>
    <Database>
        <DbProvider Name="@dbProvider.Name"/>
        <Write Name="@writeDataSource.Name" ConnectionString="${ConnectionString}"/>
    </Database>
    <TypeHandlers>
        <TypeHandler Name="Json" Type="${NamedJsonTypeHandler}">
            <Properties>
                <Property Name="DateFormat" Value="yyyy-MM-dd mm:ss"/>
                <Property Name="NamingStrategy" Value="Camel"/>
            </Properties>
        </TypeHandler>
        <TypeHandler Name="DES" Type="${CryptoTypeHandler}">
            <Properties>
                <Property Name="Algorithm" Value="DES"/>
                <Property Name="Key" Value="qxMfZpmQ1Rk="/>
                <Property Name="IV" Value="XaX73vwx694="/>
            </Properties>
        </TypeHandler>
        <TypeHandler Name="AES" Type="${CryptoTypeHandler}">
            <Properties>
                <Property Name="Algorithm" Value="AES"/>
                <Property Name="Key" Value="awVFRYPeTTrA9T7OOzaAFUvu8I/ZyYjAtIzEjCmzzYw="/>
                <Property Name="IV" Value="7cFxoI3/k1wxN9P6rEyR/Q=="/>
            </Properties>
        </TypeHandler>
    </TypeHandlers>
    <TagBuilders>
        <TagBuilder Name="Script" Type="${ScriptBuilder}"/>
    </TagBuilders>
    <IdGenerators>
        <IdGenerator Name="SnowflakeId" Type="SnowflakeId">
            <Properties>
                <Property Name="WorkerIdBits" Value="5"/>
                <Property Name="WorkerId" Value="1"/>
                <Property Name="Sequence" Value="0"/>
            </Properties>
        </IdGenerator>
    </IdGenerators>
    <SmartSqlMaps>
        <SmartSqlMap Path="Maps" Type="Directory"/>
    </SmartSqlMaps>
</SmartSqlMapConfig>